package pl.ptemich.eav.states;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import pl.ptemich.eav.structures.BoundingBox;
import pl.ptemich.eav.structures.QuadTree;

public class QuadTreeTesterState extends BasicGameState {

  private static final int STATE_ID = Double.valueOf(Math.random()).intValue(); 
  
  private QuadTree<Integer> root;
  
  
  @Override
  public int getID() {    
    return STATE_ID;
  }  
  
  @Override
  public void init(GameContainer container, StateBasedGame game)
      throws SlickException {
    root = new QuadTree<Integer>(new BoundingBox(0f ,0f ,600f));
  }
  
  @Override
  public void render(GameContainer container, StateBasedGame game, Graphics graphics)
      throws SlickException {
    root.draw(graphics);
  }
  
  @Override
  public void update(GameContainer container, StateBasedGame game, int delta)
      throws SlickException {

    Input input = container.getInput();
    if (input.isKeyDown(Input.KEY_ESCAPE)) {
      container.exit();
    }    
//    
//    if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
//      board.mouseClick(input.getMouseX(), input.getMouseY(), MouseButton.LEFT);
//    } else if (input.isMousePressed(Input.MOUSE_RIGHT_BUTTON)) {
//      board.mouseClick(input.getMouseX(), input.getMouseY(), MouseButton.RIGHT);
//    } else if (input.isMousePressed(Input.MOUSE_MIDDLE_BUTTON)) {
//      board.mouseClick(input.getMouseX(), input.getMouseY(), MouseButton.MIDDLE);
//    }
  }
  
}
